package com.zua.service.impl;
import com.zua.entity.Good;
import com.zua.mapper.GoodMapper;
import com.zua.service.GoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
@Transactional(readOnly = false,timeout = 5,propagation = Propagation.REQUIRED,isolation = Isolation.READ_COMMITTED)
public class GoodServiceImpl  implements GoodService {
    @Autowired
    private GoodMapper goodMapper;
    public void setGoodMapper(GoodMapper goodMapper) {
        this.goodMapper = goodMapper;
    }
    @Override
    @Transactional(readOnly = true)
    public List<Good> selectAll(int pageNum, int pageSize) {
        return goodMapper.selectAll(pageNum, pageSize);
    }
    @Override
    @Transactional(readOnly = true)
    public Good selectById(int id) {
        return goodMapper.selectById(id);
    }
    @Override
    public void deleteById(int id) {
        goodMapper.deleteById(id);
    }
    @Override
    public void insertGood(Good good) {
        goodMapper.insertGood(good);
    }
    @Override
    public void updateGood(Good good) {
        goodMapper.updateGood(good);
    }
    @Override
    public List<Good> selectByEntry(String entry) {
        return goodMapper.selectByEntry(entry);
    }
    @Override
    public List<Good> userShowNewGoods() {
        return goodMapper.userShowNewGoods();
    }
    @Override
    public List<Good> selectByCatelog(int catelogId) {
        return goodMapper.selectByCatelog(catelogId);
    }
    @Override
    public Integer selectNumById(int id) {
        return goodMapper.selectNumById(id);
    }
    @Override
    public List<Good> selectByUserId(int userId) {
        return goodMapper.selectByUserId(userId);
    }
}
